Skip to content

feat(gateways): Kafka Gateway add DescribeConfigs and AlterConfigs APIs - #4398

Merged
hubcio merged 16 commits into
masterfrom
feat/gateways-3546-describe-alter-configs
Oct 10, 2026
Merged

hubcio merged 16 commits into
masterfrom
feat/gateways-3546-describe-alter-configs

Conversation

@ryerraguntla

@ryerraguntla ryerraguntla commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Which issue does this PR address?

Partially closes #3546 (Part 2)
Relates to #3560

Rationale

Kafka admin clients read and change topic retention with DescribeConfigs (32) and the deprecated AlterConfigs (33). Iggy already stores that lifetime as message_expiry, and retention applies to sealed segments only. The active segment does not expire. CreateTopics rejects a per-topic config list and tells the client to set retention.ms with AlterConfigs, so these two APIs are how a client reads and writes that expiry after the topic exists.

This PR covers the topic-config half only. Unknown keys are INVALID_CONFIG (40). Kafka has no NOT_CONFIGURABLE code, which is the code the issue text suggested.

What changed?

With the bridge on, DescribeConfigs (versions 1-4) answers topic resources only. It returns retention.ms from Iggy message_expiry (-1 when sealed segments never expire) and a read-only cleanup.policy=delete. AlterConfigs (versions 0-2) persists only retention.ms, through update_topic. A value whose seconds exceed u32::MAX is rejected and is not stored. validate_only runs the same checks, including the topic lookup, and does not write.

One bad key fails that resource only. Other resources in the same request are still processed. With the bridge off, each resource gets NOT_CONTROLLER (41) and nothing is read or written. A missing topic is UNKNOWN_TOPIC_OR_PARTITION (3), checked before the config keys. More than 100 distinct topics returns POLICY_VIOLATION (44) on every resource in the request.

IncrementalAlterConfigs (44) is not implemented and is not advertised. A client that sends it gets the connection closed. Only the deprecated Admin.alterConfigs (33) writes retention.ms. CreateTopics still rejects per-topic configs and tells the client to use AlterConfigs. DeleteTopics is not in this PR and is covered in a separate PR. IncrementalAlterConfigs (44) will be implemented in another succeding PRs.

Local Execution

Passed:

  • cargo build -p iggy-gateway-kafka --tests
  • cargo clippy -p iggy-gateway-kafka --all-features --all-targets -- -D warnings
  • Unit tests for topic config, bounds, config handlers, version firewall, CreateTopics, and kafka-message-gen
  • Kafka 3.9 Java AdminClient probe on the host JDK: retention.ms=-1, then alter to 8000, unknown key rejected, validate_only did not write, describe_batch_50_elapsed_ms=22. The probe prints that elapsed time and does not assert a latency threshold.

AI Usage

Fill this in before opening.

  1. Which tools? Claude
  2. Scope of usage? Implementation and review
  3. How did you verify the generated code works correctly? Walk through and manual testing.
  4. Can you explain every line of the code if asked? Yes

…n clients need to read and set topic retention. DescribeConfigs

reports retention.ms from Iggy message expiry and a read-only cleanup.policy.
AlterConfigs persists only retention.ms, capped so segment expiry cannot wrap.
…n clients need to read and set topic retention. DescribeConfigs

reports retention.ms from Iggy message expiry and a read-only cleanup.policy.AlterConfigs persists only retention.ms, capped so segment expiry cannot wrap.
gateways/kafka/docs/CONFIGS.md
gateways/kafka/src/protocol/handlers/alter_configs.rs
gateways/kafka/src/protocol/handlers/describe_configs.rs
gateways/kafka/src/protocol/handlers/topic_config.rs
gateways/kafka/tests/common/wire.rs
gateways/kafka/tests/configs_handler_tests.rs
gateways/kafka/tests/configs_java_client_tests.rs
gateways/kafka/tests/configs_real_bridge_tests.rs
@github-actions github-actions Bot added the S-waiting-on-review PR is waiting on a reviewer label Oct 4, 2026
@ryerraguntla
ryerraguntla marked this pull request as draft October 4, 2026 13:08
@github-actions github-actions Bot removed the S-waiting-on-review PR is waiting on a reviewer label Oct 4, 2026
@ryerraguntla

Copy link
Copy Markdown
Contributor Author

Keeping it in draft mode as there few edge cases needs to be worked and documented

Milliseconds stay the value stored in Iggy. Those names are remembered
as synonyms only when an alter uses them.
@codecov

codecov Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.45%. Comparing base (0918395) to head (083600f).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #4398      +/-   ##
============================================
+ Coverage     88.43%   88.45%   +0.02%     
+ Complexity     1607     1579      -28     
============================================
  Files          1302     1293       -9     
  Lines        252565   248952    -3613     
  Branches     212730   212367     -363     
============================================
- Hits         223358   220217    -3141     
+ Misses        23811    23537     -274     
+ Partials       5396     5198     -198     
Components Coverage Δ
Rust Core 89.56% <73.33%> (+<0.01%) ⬆️
Java SDK 68.71% <ø> (-0.09%) ⬇️
C# SDK 77.60% <ø> (-1.15%) ⬇️
Python SDK 91.16% <ø> (+0.09%) ⬆️
PHP SDK 85.67% <ø> (ø)
Node SDK 96.59% <ø> (+0.08%) ⬆️
Go SDK 70.19% <ø> (-0.06%) ⬇️
C++ SDK ∅ <ø> (∅)
see 100 files with indirect coverage changes
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ryerraguntla

Copy link
Copy Markdown
Contributor Author

/skill team-review-slim

@ryerraguntla
ryerraguntla marked this pull request as ready for review October 4, 2026 20:41
@github-actions github-actions Bot added the S-waiting-on-review PR is waiting on a reviewer label Oct 4, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary: The new Kafka DescribeConfigs and AlterConfigs handlers carry three client-visible defects: per-resource Iggy round trips that serialize on the shared lockstep client, an unmodeled describe key that fails the whole resource, and an empty AlterConfigs list answered as success. Two test comments are stale, and two simplifications are noted.

Counts: critical 0, warning 3, nit 2, simplification 2


This review was generated by Claude Code 2.1.284 on deepseek-flash[1m]. Review the output before you act on it.

@github-actions github-actions Bot added S-waiting-on-author PR is waiting on author response and removed S-waiting-on-review PR is waiting on a reviewer labels Oct 4, 2026
@ryerraguntla

Copy link
Copy Markdown
Contributor Author

/ready

@github-actions github-actions Bot added S-waiting-on-review PR is waiting on a reviewer and removed S-waiting-on-author PR is waiting on author response labels Oct 4, 2026

@krishvishal krishvishal left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Main issues: the timeout comment in alter_configs.rs does not match the code, repeated describe keys blow up the response, and retention.minutes/hours are not Kafka topic configs.
Details inline. The simplification comments are cleanups, not blockers.

Comment thread gateways/kafka/README.md Resolved
@github-actions github-actions Bot added S-waiting-on-author PR is waiting on author response and removed S-waiting-on-review PR is waiting on a reviewer labels Oct 6, 2026
Comment thread gateways/kafka/docs/CONFIGS.md Resolved
@ryerraguntla

Copy link
Copy Markdown
Contributor Author

/ready

@github-actions github-actions Bot added S-waiting-on-review PR is waiting on a reviewer and removed S-waiting-on-author PR is waiting on author response labels Oct 8, 2026
@hubcio
hubcio merged commit 5f34dbc into master Oct 10, 2026
69 checks passed
@hubcio
hubcio deleted the feat/gateways-3546-describe-alter-configs branch October 10, 2026 17:12
@github-actions github-actions Bot removed the S-waiting-on-review PR is waiting on a reviewer label Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Kafka gateway: Kafka DeleteTopics, DescribeConfigs, and AlterConfigs admin APIs

4 participants